import 'dart:convert' show json;

class RespResult {

  int newincluded;
  String status;
  List<RstData> data;

  RespResult.fromParams({this.newincluded, this.status, this.data});

  factory RespResult(jsonStr) => jsonStr == null ? null : jsonStr is String ? new RespResult.fromJson(json.decode(jsonStr)) : new RespResult.fromJson(jsonStr);

  RespResult.fromJson(jsonRes) {
    newincluded = jsonRes['newincluded'];
    status = jsonRes['status'];
    data = jsonRes['data'] == null ? null : [];

    for (var dataItem in data == null ? [] : jsonRes['data']){
      data.add(dataItem == null ? null : new RstData.fromJson(dataItem));
    }
  }

  @override
  String toString() {
    return '{"newincluded": $newincluded,"status": ${status != null?'${json.encode(status)}':'null'},"data": $data}';
  }
}

class RstData {

  int id;
  int iftobuy;
  int imgh;
  int imgw;
  String buyurl;
  String country;
  String fromsite;
  String image;
  String mall;
  String pubtime;
  String title;

  RstData.fromParams({this.id, this.iftobuy, this.imgh, this.imgw, this.buyurl, this.country, this.fromsite, this.image, this.mall, this.pubtime, this.title});

  RstData.fromJson(jsonRes) {
    id = jsonRes['id'];
    iftobuy = jsonRes['iftobuy'];
    imgh = jsonRes['imgh'];
    imgw = jsonRes['imgw'];
    buyurl = jsonRes['buyurl'];
    country = jsonRes['country'];
    fromsite = jsonRes['fromsite'];
    image = jsonRes['image'];
    mall = jsonRes['mall'];
    pubtime = jsonRes['pubtime'];
    title = jsonRes['title'];

  }

  @override
  String toString() {
    return '{"id": $id,"iftobuy": $iftobuy,"imgh": $imgh,"imgw": $imgw,"buyurl": ${buyurl != null?'${json.encode(buyurl)}':'null'},"country": ${country != null?'${json.encode(country)}':'null'}},"fromsite": ${fromsite != null?'${json.encode(fromsite)}':'null'},"image": ${image != null?'${json.encode(image)}':'null'},"mall": ${mall != null?'${json.encode(mall)}':'null'},"pubtime": ${pubtime != null?'${json.encode(pubtime)}':'null'},"title": ${title != null?'${json.encode(title)}':'null'}}';
  }
}

